﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSConsoleTest
{
    class TestNullable : BaseConsoleTest
    {
        public void printDescription()
        {
            Console.WriteLine("--- Nullable ---"); 
        }

        public void doTest()
        {
            int? nullableInt = null;
            Console.WriteLine("before setting value : has value : {0}", nullableInt.HasValue);
            //Below line occures NullPointerException
            //Console.WriteLine("before setting value : value :  {0}", nullableInt.Value);

            nullableInt = 10;
            Console.WriteLine("after setting value : has value : {0}", nullableInt.HasValue);
            Console.WriteLine("after setting value : value :  {0}", nullableInt.Value);
        }
    }
}
